using System.Collections.Generic;
using Lucene.Net.Documents;
using Webshop20.Constants;

namespace Webshop20.AntiCorruptionLayers.Lucene
{
    public class ProductIdTranslator : IProductIdTranslator
    {
        public IEnumerable<int> ConvertToProductIds(IEnumerable<Document> documents)
        {
            foreach (var document in documents)
            {
                yield return int.Parse(document.GetField(CONSTANTS.KEYS.FULLTEXT_SEARCH_ID_FIELD).StringValue());
            }
        }
    }
}